package com.bizmerce.rnd.oms.codemng.service.impl;

import java.util.HashMap;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.bizmerce.rnd.oms.codemng.service.FtaSearchVO;
import com.bizmerce.rnd.oms.codemng.service.ViewVO;

import egovframework.rte.psl.dataaccess.EgovAbstractDAO;

@SuppressWarnings("unchecked")
@Repository("viewDAO")
public class ViewDAO extends EgovAbstractDAO {
	/**
	 * 품목별기준 - 정보 가져오기
	 * @param id
	 */
	public List<ViewVO> selectView(FtaSearchVO searchVO) {
		int skipResult = (searchVO.getPageIndex() - 1) * searchVO.getPageUnit();
		int maxResult = searchVO.getPageUnit();
		
		HashMap<String, String> param = new HashMap<String, String>();
		param.put("AGREE_CD", searchVO.getId());
		return getSqlMapClientTemplate().queryForList("CodeMng.selectView", param, skipResult, maxResult);
	}
	
	/**
	 * 
	 * @param searchVO
	 * @return
	 */
	public int selectViewCount(FtaSearchVO searchVO) {
		HashMap<String, String> param = new HashMap<String, String>();
		param.put("AGREE_CD", searchVO.getId());
		return (Integer) getSqlMapClientTemplate().queryForObject("CodeMng.selectViewCount", param);
	}
}